package com.example.traning.mybatisplus.controller;

import com.example.traning.mybatisplus.dal.entity.Emp;
import com.example.traning.mybatisplus.dal.mapper.EmpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lei yu
 * @since 2025/04/27
 */
@RequestMapping("/emp")
@RestController
public class EmpController {
    @Autowired
    private EmpMapper empMapper;

    /**
     * localhost:8080/emp/7369
     */
    @GetMapping("/{id}")
    public Emp getEmpById(@PathVariable(name = "id") Integer id) {
        return empMapper.selectById(id);
    }
}
